/*
 * This file is part of the SDWebImage package.
 * (c) Olivier Poitrey <rs@dailymotion.com>
 * (c) Fabrice Aneche
 * 为了避免库冲突，改了类名
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

#import <Foundation/Foundation.h>
/**
 You can use switch case like normal enum. It's also recommended to add a default case. You should not assume anything about the raw value.
 For custom coder plugin, it can also extern the enum for supported format. See `SDImageCoder` for more detailed information.
 */
typedef NSInteger DGGImageFormat NS_TYPED_EXTENSIBLE_ENUM;
static const DGGImageFormat DGGImageFormatUndefined = -1;
static const DGGImageFormat DGGImageFormatJPEG      = 0;
static const DGGImageFormat DGGImageFormatPNG       = 1;
static const DGGImageFormat DGGImageFormatGIF       = 2;
static const DGGImageFormat DGGImageFormatTIFF      = 3;
static const DGGImageFormat DGGImageFormatWebP      = 4;
static const DGGImageFormat DGGImageFormatHEIC      = 5;
static const DGGImageFormat DGGImageFormatHEIF      = 6;
static const DGGImageFormat DGGImageFormatPDF       = 7;
static const DGGImageFormat DGGImageFormatSVG       = 8;

/**
 NSData category about the image content type and UTI.
 */
@interface NSData (GGContentType)

/**
 *  Return image format
 *
 *  @param data the input image data
 *
 *  @return the image format as `DGGImageFormat` (enum)
 */
+ (DGGImageFormat)dgg_imageFormatForImageData:(nullable NSData *)data;


+ (NSString *)dgg_imageFormatStringForImageData:(nullable NSData *)data;

/**
 *  Convert DGGImageFormat to UTType
 *
 *  @param format Format as DGGImageFormat
 *  @return The UTType as CFStringRef
 *  @note For unknown format, `kUTTypeImage` abstract type will return
 */
+ (nonnull CFStringRef)dgg_UTTypeFromImageFormat:(DGGImageFormat)format CF_RETURNS_NOT_RETAINED NS_SWIFT_NAME(dgg_UTType(from:));

/**
 *  Convert UTTyppe to DGGImageFormat
 *
 *  @param uttype The UTType as CFStringRef
 *  @return The Format as DGGImageFormat
 *  @note For unknown type, `DGGImageFormatUndefined` will return
 */
+ (DGGImageFormat)dgg_imageFormatFromUTType:(nonnull CFStringRef)uttype;

@end
